<?php
include_once("model/AgendaModel.php");

class AgendaController {
	public $agendaModel;
	
	public function __construct()  
    {  
        $this->agendaModel = new AgendaModel();
    } 
	public function getAgendaList()
	{
			//GET ALL
			$agendas = $this->agendaModel->getAllAgendaList();

			$resultData = array();
			$i = 0;
			foreach ($agendas as $agenda){
				$resultData[$i] = $agenda;
				$dayactivitys = $this->agendaModel->getDayActivityByTourCode($agenda["tourcode"]);
				$resultData[$i]['dayactivitys']=$dayactivitys;
				$j = 0;
				foreach ($dayactivitys as $dayactivity){
					$activityDetails = $this->agendaModel->getActivityDetailByIdentifyDay($dayactivity["identify"]);
					$resultData[$i]['dayactivitys'][$j]['activityDetail']= $activityDetails;
					$j++;
				}
				$i++;
			}
			include 'view/json/agendaview.php';
	}
	public function getAgendaByTourcode($tourcode)
	{
			$agenda = $this->agendaModel->getAgendaByTourcode($tourcode);
			include 'view/json/agendaview.php';
	}
/*	public function getAgendaListByTourguiderId($tourguide_id)
	{
			$agenda = $this->agendaModel->getAgendaListByTourguiderId($tourguide_id);
			include 'view/json/agendaview.php';
	}*/
	
	
	
}

?>